package com.example.Service.impl;

import com.example.Service.FinanceRecordService;
import com.example.entity.FinanceRecord;
import com.example.mapper.FinanceRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FinanceRecordServiceImpl implements FinanceRecordService {

    @Autowired
    private FinanceRecordMapper financeRecordMapper;

    @Override
    public int addFinanceRecord(FinanceRecord record) {
        return financeRecordMapper.insertFinanceRecord(record);
    }

    @Override
    public int deleteFinanceRecordById(Integer recordId) {
        return financeRecordMapper.deleteFinanceRecordById(recordId);
    }

    @Override
    public int updateFinanceRecord(FinanceRecord record) {
        return financeRecordMapper.updateFinanceRecord(record);
    }

    @Override
    public List<FinanceRecord> getFinanceRecordsByUserId(Integer userId) {
        return financeRecordMapper.getFinanceRecordsByUserId(userId);
    }
}

